import { Injectable } from '@angular/core';
import { UtilService } from '../util.service';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
@Injectable()
export class GoodService {

  public url: any;
  detailurl:any;
  constructor( public utilservice: UtilService) {
   
    this.url = '/api/gooditem/';
    this.detailurl='http://hws.m.taobao.com/cache/mtop.wdetail.getItemDescx/4.1/'

   }

   public getGood(id) {
    let url = this.url+id;
    return this.utilservice.get(url);
  }

  public loadGoodDetail(id) {
    let url = this.detailurl+'?&data={%22item_num_id%22:%22'+id+'%22}';
    return this.utilservice.jsonp(url);
  }

}
